package org.brownflat.watergate.resources.mysql;

import org.brownflat.watergate.resources.MySqlUpgrade;
import org.springframework.stereotype.Component;

/**
 * <p>&copy Rupert Jones 2011,2012</p>
 *
 * @author rup
 */
@Component
public class Upgrade0002CreateDefaultAuthData implements MySqlUpgrade {

    private static final int VERSION = 2;

    @Override
    public int getSequence() {
        return VERSION;
    }

    @Override
    public String getSql() {
        return "INSERT INTO wgate_user (id, full_name, username, password, created_at, updated_at) VALUES (1,'Administrator', 'admin','dc50f2f16e35c0a41a981394eb14289bbab7f17634d9d5ac6ec05b5cfa5b7e08', current_timestamp, current_timestamp);\n"
                + "INSERT INTO wgate_role (id, name, created_at, updated_at) VALUES (1, 'ADMIN', current_timestamp, current_timestamp);\n"
                + "INSERT INTO wgate_user_role (user_id,role_id) VALUES (1,1);";
    }

    @Override
    public String getName() {
        return "Create default auth data";
    }
}
